package co.fitstart.weapp.api.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.demo2do.core.persistence.GenericDaoSupport;
import com.demo2do.core.persistence.annotation.Dao;

import co.fitstart.entity.site.Site;
import co.fitstart.weapp.api.dao.SiteDao;
import co.fitstart.weapp.api.service.SiteService;

/**
 * 
 * @author haiyan_xiao
 *
 */
@Service("siteService")
public class SiteServiceImpl implements SiteService {

    @Autowired
    private GenericDaoSupport genericDaoSupport;

    @Dao
    private SiteDao siteDao;

    /*
     * (non-Javadoc)
     * @see co.fitstart.weapp.api.service.SiteService#load(java.lang.Long)
     */
    public Site load(Long siteId) {
        Site site = genericDaoSupport.load(Site.class, siteId);
        return (site == null || site.isDisabled()) ? null : site;
    }

    /*
     * (non-Javadoc)
     * @see co.fitstart.weapp.api.service.SiteService#list()
     */
    public List<Site> list() {
        return siteDao.list();
    }

}
